package com.bingxue.edu.common.job;

import com.bingxue.edu.framework.exception.SystemException;
import com.bingxue.edu.framework.job.DynamicJob;
import lombok.extern.slf4j.Slf4j;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.scheduling.quartz.QuartzJobBean;

/**
 * @author panbo
 * @since 2024/8/26
 */
@Slf4j
@DisallowConcurrentExecution
@DynamicJob(name="测试定时任务", cron = "0 0 0/1 * * ? ", paramClass = DemoJobParam.class)
public class DemoJob extends QuartzJobBean {

    @Override
    protected void executeInternal(JobExecutionContext context) {
        JobDataMap jobDataMap = context.getJobDetail().getJobDataMap();
        String name = jobDataMap.getString("name");
        log.info("[demo job] hello, {}!", name);
        log.info("模板任务执行");
    }
}
